﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CSharp.Study_DelegateEvent
{
    public class DelegateDemo
    {
        public delegate void PrintMsg(string str);

        public void Go()
        {
            var fun1 = new PrintMsg(PrintFirst);
            fun1+= new PrintMsg(PrintSecond);
            fun1-= new PrintMsg(PrintFirst);
            fun1("666");
        }

        public void PrintFirst(string str) => Console.WriteLine($"First_{str}");

        public void PrintSecond(string str) => Console.WriteLine($"Second_{str}");
    }
}
